<%@page language="java" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@ include file="/view/common/taglib.jsp"%>
<%@ include file="/view/common/variable.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/view/common/head.jsp"%>
<meta name="keywords" content="学而阅读,小说网,原创小说网" />
<meta name="description"
	content="学而阅读,最热门的免费小说网站,提供武侠仙侠,奇幻玄幻,科幻灵异,都市言情,穿越女频,青春校园,历史军事,网游竞技,职业官场等网络热门的书籍下载跟阅读！" />
<title>学而阅读作家后台</title>
<link rel="stylesheet" href="<%=path%>/css/style.css" />
<script type="text/javascript" src="<%=path%>/js/base.js"></script>
<script type="text/javascript">
	var tagArray;
	//作品标签点击弹框
	var arr = new Array();
	$(document).ready(function() {
		$('.worklabel ul').on('click', function() {
			bomb();
			$(".labelfd").fadeIn();

		});
		//标签选择
		$('.labelfdz ul li').on('click', function() {
			var type = $(this).attr("data-id");
			var copyThisB = $(this).clone();
			$(this).toggleClass("active");
			var length = $(".active").length;
			if (length > 5) {
				display("最多只能选择5个作为您的作品标签");
				$(this).removeClass("active");
			} else {
				if (!$(this).hasClass("active")) {
					$(".worklabel ul li[data-id='" + type + "']").remove();
					arr.splice($.inArray(type, arr), 1);
					//             alert(arr);
				} else {
					$(".worklabel ul").append(copyThisB);
					arr.push($(this).attr("data-id"));
					//          	alert(arr)
				}
			}
		});
		$(".labelfdz ul li.active").each(function() {
			arr.push($(this).attr("data-id"));
		});
		//标签确认
		$('.labela').on('click', function() {
			tagArray = arr;
			$("#tagIds").val(tagArray);
			bombhide();
			$(".labelfd").hide();
		});

	});
	function submitForm() {
		var bookDesc = $.trim($("#bookDesc").val());
		if (bookDesc != "") {
			$("#validInfo").text("");
			$("#form").submit();
		} else {
			$("#validInfo").text("请填写作品描述!");
			return false;
		}
	}
</script>
</head>

<body ng-app="myApp" ng-controller='ShowController'>
	<%@ include file="/view/common/header.jsp"%>
	<div class="content clearfix">
		<%@ include file="/view/common/left.jsp"%>
		<!--右边-->
		<div class="right r">
			<div class="path">
				作品管理 > <span>作品列表</span>
			</div>

			<div class="editnav">
				<ul>
					<li class="editnavo"><a
						href="<%=path%>/book/detail?bookId=${bookId}">作品设置</a></li>
					<li><a href="<%=path%>/chapter/draftList?bookId=${bookId}">草稿箱</a></li>
					<li><a href="<%=path%>/chapter/publishList?bookId=${bookId}">已发布章节</a></li>
				</ul>
				<a href="<%=path%>/chapter/add?bookId=${bookId}" class="addedit"><img
					src="<%=path%>/image/xzzj.png" /></a>
			</div>

			<!--作品设置-->
			<div class="edit">
				<form action="<%=path%>/book/update" name="form" id="form"
					method="post">
					<div class="workset">
						<b class="worksetimg"><c:if test="${book.bookImageType==0}">
								<img src="${sourceUrl}/${book.bookImage}" />
							</c:if> <c:if test="${book.bookImageType==1}">
								<img src="${book.bookImage}" />
							</c:if></b>

						<div class="worksetr worksetr2">
							<ul>
								<li><b>作品名称：</b><span>${book.bookName}</span> <b>作品ID：</b><span>${book.bookId}</span></li>
								<li><b>作品类型：</b><span> <select id="bookCategoryId"
										name="bookCategoryId">
											<c:forEach var="category" items="${categoryList}"
												varStatus="status">
												<option value="${category.categoryId}"
													<c:if test="${category.categoryId==book.bookCategoryId}">selected="selected"</c:if>>${category.categoryName}</option>
											</c:forEach>
									</select>

								</span></li>
								<li><b>作品标签：</b><span class="worklabel">
										<ul>
											<c:forEach var="bookTag" items="${bookTagList}"
												varStatus="status">
												<li data-id="${bookTag.tagId}">${bookTag.tagName}</li>
											</c:forEach>
										</ul>
								</span></li>
								<li><b>作品状态：</b> <span><c:if
											test="${book.bookStatus ==1}">
											<font style="color: green;">上架</font>
										</c:if> <c:if test="${book.bookStatus ==2}">
											<font style="color: orange;">审核中</font>
										</c:if> <c:if test="${book.bookStatus ==-1}">
											<font style="color: red;">拒绝</font>
										</c:if> <c:if test="${book.bookStatus ==0}">
											<font style="color: silver;">未知</font>
										</c:if></span></li>
								<li><b>作品简介：</b> <span><textarea id="bookDesc"
											name="bookDesc">${book.bookDesc}</textarea></span></li>
								<li></li>
							</ul>
							<span id="validInfo" style="color: red;"></span> <input
								type="hidden" name="bookId" id="bookId" value="${book.bookId }" /><input
								type="hidden" value="" name="tagIds" id="tagIds" /> <a
								class="modifysel" onclick="submitForm();return false;">保存</a>

						</div>
					</div>
				</form>
			</div>
			<!--作品设置-->
		</div>
		<!--右边-->
	</div>

	<div class="labelfd">
		<div class="labelfds">
			选择标签<s><img src="<%=path%>/image/close.png" /></s>
		</div>
		<div class="fivelabel">请选择最多5个作为您的作品标签</div>
		<div class="labelfdz">
			<b>风格</b>
			<ul>
				<c:forEach var="tag" items="${tagList}" varStatus="status">
					<li data-id="${tag.tagId}"
						<c:if test="${tag.isSelect==1 }">class="active" </c:if>>${tag.tagName}</li>
				</c:forEach>
			</ul>
		</div>
		<a class="labela">确 认</a>
	</div>

</body>
</html>